package com.xiaogao.common.entity;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Result<T> {
    private int code;
    private T data;
    private String message;

    public static <T> Result<T> success(T data) {
        return new Result<>(200, data, "操作成功！");
    }

    public static Result<Object> success() {
        return new Result<>(200, null, "操作成功！");
    }

    public static <T> Result<T> failed(int code, String message) {
        return new Result<>(code, null, message);
    }
}
